import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '承包商名称',
    align:"center",
    sorter: true,
    dataIndex: 'name'
  },
  {
    title: '类型',
    align:"center",
    dataIndex: 'type_dictText'
  },
  {
    title: '税码/社会信用代码',
    align:"center",
    dataIndex: 'socialCreditCode'
  },
  {
    title: '承包商负责人',
    align:"center",
    dataIndex: 'chargePeople'
  },
  {
    title: '承包商代码',
    align:"center",
    dataIndex: 'number'
  },
  {
    title: '资质审查',
    align:"center",
    dataIndex: 'qualificationExamination_dictText'
  },
  {
    title: '通讯地址',
    align:"center",
    dataIndex: 'mailingAddress'
  },
  {
    title: '联系人',
    align:"center",
    dataIndex: 'contactPerson'
  },
  {
    title: '联系方式',
    align:"center",
    dataIndex: 'contactTel'
  },
  {
    title: '状态',
    align:"center",
    dataIndex: 'deleted_dictText'
  },
  {
    title: '创建人',
    align:"center",
    dataIndex: 'createBy'
  },
  {
    title: '创建日期',
    align:"center",
    sorter: true,
    dataIndex: 'createTime'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "承包商名称",
    field: "name",
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "类型",
    field: "type",
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"contractorType"
    },
    //colProps: {span: 6},
  },
  {
    label: "资质审查",
    field: "qualificationExamination",
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"qualificationExamination"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '承包商名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入承包商名称!'},
      ];
     },
  },
  {
    label: '类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"contractorType"
    },
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入类型!'},
      ];
     },
  },
  {
    label: '税码/社会信用代码',
    field: 'socialCreditCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入税码/社会信用代码!'},
      ];
     },
  },
  {
    label: '承包商负责人',
    field: 'chargePeople',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入承包商负责人!'},
      ];
     },
  },
  {
    label: '承包商代码',
    field: 'number',
    component: 'Input',
  },
  {
    label: '资质审查',
    field: 'qualificationExamination',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"qualificationExamination"
    },
  },
  {
    label: '通讯地址',
    field: 'mailingAddress',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入通讯地址!'},
      ];
     },
  },
  {
    label: '联系人',
    field: 'contactPerson',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入联系人!'},
      ];
     },
  },
  {
    label: '联系方式',
    field: 'contactTel',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入联系方式!'},
      ];
     },
  },
  {
    label: '状态',
    field: 'deleted',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"normalOrStop"
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
	field: 'id',
	component: 'Input',
	show: false
  },
];

//子表列表数据
export const tbContractorSafetyPermitColumns: BasicColumn[] = [
  {
    title: '证书编号',
    align:"center",
    dataIndex: 'number'
  },
  {
    title: '开始时间',
    align:"center",
    dataIndex: 'startDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
  },
  {
    title: '结束时间',
    align:"center",
    dataIndex: 'endDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
  },
  {
    title: '资质证书附件',
    align:"center",
    dataIndex: 'doc',
  },
  {
    title: '政府网站截屏',
    align:"center",
    dataIndex: 'img',
    customRender:render.renderImage,
  },
  {
    title: '备注',
    align:"center",
    dataIndex: 'remarks'
  },
  {
    title: '状态',
    align:"center",
    dataIndex: 'deleted_dictText'
  },
];
//子表表单数据
export const tbContractorSafetyPermitFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '证书编号',
    field: 'number',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入证书编号!'},
      ];
    },
  },
  {
    label: '开始时间',
    field: 'startDate',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入开始时间!'},
      ];
    },
  },
  {
    label: '结束时间',
    field: 'endDate',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入结束时间!'},
      ];
    },
  },
  {
    label: '资质证书附件',
    field: 'doc',
    component: 'JUpload',
    componentProps:{
     },
  },
  {
    label: '政府网站截屏',
    field: 'img',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '备注',
    field: 'remarks',
    component: 'InputTextArea',
  },
  {
    label: '状态',
    field: 'deleted',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"normalOrStop"
    },
  },
];
//子表列表数据
export const tbContractorBusinessLicenseColumns: BasicColumn[] = [
  {
    title: '营业执照编号',
    align:"center",
    dataIndex: 'number'
  },
  {
    title: '开始时间',
    align:"center",
    dataIndex: 'startDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
  },
  {
    title: '结束时间',
    align:"center",
    dataIndex: 'endDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
  },
  {
    title: '备注',
    align:"center",
    dataIndex: 'remarks'
  },
  {
    title: '执照附件',
    align:"center",
    dataIndex: 'doc',
  },
  {
    title: '政府网站截图',
    align:"center",
    dataIndex: 'img',
    customRender:render.renderImage,
  },
  {
    title: '状态',
    align:"center",
    dataIndex: 'deleted_dictText'
  },
];
//子表表单数据
export const tbContractorBusinessLicenseFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '营业执照编号',
    field: 'number',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入营业执照编号!'},
      ];
    },
  },
  {
    label: '开始时间',
    field: 'startDate',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入开始时间!'},
      ];
    },
  },
  {
    label: '结束时间',
    field: 'endDate',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入结束时间!'},
      ];
    },
  },
  {
    label: '备注',
    field: 'remarks',
    component: 'Input',
  },
  {
    label: '执照附件',
    field: 'doc',
    component: 'JUpload',
    componentProps:{
     },
  },
  {
    label: '政府网站截图',
    field: 'img',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '状态',
    field: 'deleted',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"normalOrStop"
    },
  },
];
//子表列表数据
export const tbContractorAptitudeColumns: BasicColumn[] = [
  {
    title: '业务资质证书',
    align:"center",
    dataIndex: 'name'
  },
  {
    title: '业务资质编号',
    align:"center",
    dataIndex: 'number'
  },
  {
    title: '资质等级',
    align:"center",
    dataIndex: 'grade'
  },
  {
    title: '开始时间',
    align:"center",
    dataIndex: 'startDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
  },
  {
    title: '结束时间',
    align:"center",
    dataIndex: 'endDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
  },
  {
    title: '附件',
    align:"center",
    dataIndex: 'doc',
  },
  {
    title: '政府网站截图',
    align:"center",
    dataIndex: 'img',
    customRender:render.renderImage,
  },
  {
    title: '状态',
    align:"center",
    dataIndex: 'deleted_dictText'
  },
];
//子表表单数据
export const tbContractorAptitudeFormSchema: FormSchema[] = [
  // TODO 子表隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: '业务资质证书',
    field: 'name',
    component: 'Input',
  },
  {
    label: '业务资质编号',
    field: 'number',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入业务资质编号!'},
      ];
    },
  },
  {
    label: '资质等级',
    field: 'grade',
    component: 'Input',
  },
  {
    label: '开始时间',
    field: 'startDate',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入开始时间!'},
      ];
    },
  },
  {
    label: '结束时间',
    field: 'endDate',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
      return [
        { required: true, message: '请输入结束时间!'},
      ];
    },
  },
  {
    label: '附件',
    field: 'doc',
    component: 'JUpload',
    componentProps:{
     },
  },
  {
    label: '政府网站截图',
    field: 'img',
     component: 'JImageUpload',
     componentProps:{
      },
  },
  {
    label: '状态',
    field: 'deleted',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"normalOrStop"
    },
  },
];

// 高级查询数据
export const superQuerySchema = {
  createBy: {title: '创建人',order: 0,view: 'text', type: 'string',},
  createTime: {title: '创建日期',order: 1,view: 'datetime', type: 'string',},
  name: {title: '承包商名称',order: 2,view: 'text', type: 'string',},
  type: {title: '类型',order: 3,view: 'list', type: 'string',dictCode: 'contractorType',},
  socialCreditCode: {title: '税码/社会信用代码',order: 4,view: 'text', type: 'string',},
  chargePeople: {title: '承包商负责人',order: 5,view: 'text', type: 'string',},
  number: {title: '承包商代码',order: 6,view: 'text', type: 'string',},
  qualificationExamination: {title: '资质审查',order: 7,view: 'list', type: 'string',dictCode: 'qualificationExamination',},
  mailingAddress: {title: '通讯地址',order: 8,view: 'text', type: 'string',},
  contactPerson: {title: '联系人',order: 9,view: 'text', type: 'string',},
  contactTel: {title: '联系方式',order: 10,view: 'text', type: 'string',},
  deleted: {title: '状态',order: 11,view: 'radio', type: 'string',},
};
